package com.aspose.cells;

import java.util.Iterator;

class zaal extends zyr {
   private zaye a;
   private int b;
   private zaar c;

   public zaal(int var1, zaye var2) {
      this.a = var2;
      this.b = var1;
   }

   public zagu i() {
      return new zaal(this.b, new zaye(this.a));
   }

   public zaye k() {
      return this.a;
   }

   public int b() {
      return 9;
   }

   public Object c() {
      return this.a;
   }

   public boolean g() {
      return true;
   }

   public void a(boolean var1) {
      if (this.c == null) {
         this.c = new zaar();
      }

   }

   public zaar h() {
      return this.c;
   }

   public void a(zaar var1) {
      this.c = var1;
   }

   public int b(zaay var1, int var2) {
      if (this.a.l()) {
         return 2;
      } else {
         return this.a.a() != null && (var2 == 96 || this.a.m()) ? 0 : 1;
      }
   }

   public int b(zaay var1, boolean var2) {
      if (this.a.j()) {
         if (this.a.k()) {
            return 0;
         } else {
            return !var2 && !this.a.m() ? 0 : 2;
         }
      } else if (this.a.k()) {
         return !var2 && !this.a.m() ? 0 : 1;
      } else {
         return !var2 && !this.a.m() ? 0 : 3;
      }
   }

   public boolean a(zaay var1, int var2, int var3, boolean var4) {
      boolean var5 = false;
      if (var1.g != var2) {
         if (!this.a.c()) {
            this.a.a(this.a.b() + var1.g - var2);
            var5 = true;
         }

         if (!this.a.g()) {
            this.a.c(this.a.f() + var1.g - var2);
            var5 = true;
         }
      }

      if (var1.h != var3) {
         if (!this.a.e()) {
            this.a.b(this.a.d() + var1.h - var3);
            var5 = true;
         }

         if (!this.a.i()) {
            this.a.d(this.a.h() + var1.h - var3);
            var5 = true;
         }
      }

      if (var5) {
         if (this.c != null) {
            this.c.a = null;
            if (this.c.b != null) {
               this.c.b.a(var1);
            }
         }

         return true;
      } else if (var4) {
         return false;
      } else if ((var1.g == var2 || this.a.q() <= 1) && (var1.h == var3 || this.a.p() <= 1)) {
         return false;
      } else {
         if (this.c != null) {
            this.c.a = null;
         }

         return true;
      }
   }

   public boolean c(zaay var1, boolean var2) {
      if (var2) {
         return true;
      } else {
         if (this.c == null) {
            this.c = new zaar();
         } else if (this.c.a != null) {
            return this.c.a.c(var1, var2);
         }

         zur var4 = this.a.a(var1);
         Object var3;
         if (var4 != null && var4.b != var4.c) {
            var3 = zzf.a;
         } else if (this.b == 96) {
            var3 = this.b(var1, var4, this.a.b(), this.a.d(), true);
         } else {
            var3 = this.a(var1, var4, var1.g, var1.h, false);
         }

         this.c.a = (zagu)var3;
         return ((zagu)var3).c(var1, var2);
      }
   }

   public Object b(zaay var1) {
      return new ReferredArea(this.a, var1);
   }

   public int d() {
      return this.b;
   }

   public int a(zaay var1) {
      return 32;
   }

   public void e() {
      this.b = 96;
   }

   public byte a() {
      return -1;
   }

   public zyy a(zaay var1, int var2) {
      zagu var3 = this.e(var1);
      if (var3 == null) {
         return zaaq.d(var2) ? new zyy(0.0D) : null;
      } else {
         return var3.a(var1, var2);
      }
   }

   public zaam i(zaay var1) {
      zagu var2 = this.e(var1);
      return var2 == null ? new zaam("") : var2.i(var1);
   }

   public zyv j(zaay var1) {
      zagu var2 = this.e(var1);
      return var2 == null ? zyw.a : var2.j(var1);
   }

   public zagu e(zaay var1) {
      if (this.c == null) {
         this.c = new zaar();
      } else if (this.c.a != null) {
         return this.c.a.e(var1);
      }

      zur var3 = this.a.a(var1);
      Object var2;
      if (var3 != null && var3.b != var3.c) {
         var2 = zzf.a;
      } else if (this.b != 96 && var1.a != 5) {
         var2 = this.a(var1, var3, var1.g, var1.h, true);
      } else {
         var2 = this.b(var1, var3, this.a.b(), this.a.d(), false);
      }

      this.c.a = (zagu)var2;
      if (var1.p.r && var1.a == 0 && (var3 == null || (var3.a & '\uffff') == var1.p.i)) {
         var1.e.b.e.a(((zyi)var1.f).a, var3 == null ? var1.n : var3.b & '\uffff', this.a.b(), this.a.d());
      }

      return (zagu)var2;
   }

   private zagu a(zaay var1, zur var2, int var3, int var4, boolean var5) {
      if (this.a.b() != this.a.f()) {
         if (this.a.b() > var3 || this.a.f() < var3) {
            return zzg.a;
         }

         if (this.a.d() != this.a.h()) {
            if (this.a.d() > var4 || this.a.h() < var4) {
               return zzg.a;
            }
         } else {
            var4 = this.a.d();
         }
      } else if (this.a.d() != this.a.h()) {
         if (this.a.d() > var4 || this.a.h() < var4) {
            return zzg.a;
         }

         var3 = this.a.b();
      } else {
         var3 = this.a.b();
         var4 = this.a.d();
      }

      return this.b(var1, var2, var3, var4, !var5);
   }

   private zagu b(zaay var1, zur var2, int var3, int var4, boolean var5) {
      if (var2 == null) {
         return zaaq.a(var1.e, var3, var4, var5, var1);
      } else if ((var2.a & '\uffff') == var1.p.i) {
         return (zagu)((var2.b & '\uffff') >= var1.p.g.getCount() ? zzf.a : zaaq.a(var1.p.g.get(var2.b & '\uffff').getCells(), var3, var4, var5, var1));
      } else {
         return zaaq.a(var1, var2.a & '\uffff', var2.b & '\uffff', var3, var4);
      }
   }

   boolean l(zaay var1) {
      zur var2 = this.a.a(var1);
      return this.a(var2, var1);
   }

   boolean a(zur var1, zaay var2) {
      if (var1 == null) {
         return false;
      } else if ((var1.b & '\uffff') < 0) {
         return true;
      } else if ((var1.a & '\uffff') == var2.p.i) {
         return (var1.b & '\uffff') >= var2.p.g.getCount();
      } else {
         zbqg var3 = var2.p.g.v().a(var1.a & '\uffff');
         if (var3.c() != null && (Math.max(var1.b, var1.c) & '\uffff') < var3.c().length) {
            if ((var1.c & '\uffff') > (var1.b & '\uffff')) {
               for(int var4 = var1.b & '\uffff'; var4 <= (var1.c & '\uffff'); ++var4) {
                  if (var3.c(var4) == null) {
                     return true;
                  }
               }
            } else if (var3.c(var1.b & '\uffff') == null) {
               return true;
            }

            return false;
         } else {
            return true;
         }
      }
   }

   public zagu d(zaay var1) {
      return (zagu)(this.l(var1) ? zzf.a : this);
   }

   public boolean f() {
      return false;
   }

   public boolean f(zaay var1) {
      return this.a.m();
   }

   public boolean g(zaay var1) {
      return this.a.q() == 1;
   }

   public boolean h(zaay var1) {
      return this.a.p() == 1;
   }

   public zagu a(int[] var1, zaay var2, boolean var3) {
      if (this.a.q() == 1 && this.a.p() == 1) {
         var1[0] = 1;
         var1[1] = 1;
         return this;
      } else {
         int var4 = var1[0] + this.a.b();
         int var5 = var1[1] + this.a.d();
         var1[0] = this.a.q();
         var1[1] = this.a.p();
         if (var4 <= this.a.f() && var5 <= this.a.h()) {
            if (var3) {
               zaye var7 = new zaye(this.a.a(), var4, var5, var4, var5);
               return new zaal(this.b, var7);
            } else {
               if (var2.p.r && var2.a == 0) {
                  zur var6 = this.a.a();
                  if (var6 == null || (var6.a & '\uffff') == var2.p.i) {
                     var2.e.b.e.a(((zyi)var2.f).a, var6 == null ? var2.n : var6.b & '\uffff', this.a.b(), this.a.d());
                  }
               }

               return this.b(var2, this.a.a(var2), var4, var5, true);
            }
         } else {
            return zzb.a;
         }
      }
   }

   public zagu a(int[] var1, zaay var2) {
      if (this.a.q() == 1) {
         var1[0] = 1;
         return this;
      } else {
         int var3 = var1[0] + this.a.b();
         var1[0] = this.a.q();
         if (var3 > this.a.f()) {
            return zzb.a;
         } else {
            zaye var4 = new zaye(this.a.a(), var3, this.a.d(), var3, this.a.h());
            return new zaal(this.b, var4);
         }
      }
   }

   public zagu b(int[] var1, zaay var2) {
      if (this.a.p() == 1) {
         var1[0] = 1;
         return this;
      } else {
         int var3 = var1[0] + this.a.d();
         var1[0] = this.a.p();
         if (var3 > this.a.h()) {
            return zzb.a;
         } else {
            zaye var4 = new zaye(this.a.a(), this.a.b(), var3, this.a.f(), var3);
            return new zaal(this.b, var4);
         }
      }
   }

   public zahn a(zaay var1, boolean var2) {
      zahn var3;
      zur var4;
      if (!var2 && this.c != null && this.c.b != null) {
         var3 = this.c.b.c(var1);
         if (var3 != null) {
            if (!var3.l() && var1.p.r && var1.a == 0) {
               var4 = this.a.a();
               if (var4 == null || (var4.a & '\uffff') == var1.p.i) {
                  var1.e.b.e.a(((zyi)var1.f).a, var4 == null ? var1.n : var4.b & '\uffff', this.a.b(), this.a.d(), this.a.f(), this.a.h());
               }
            }

            if (!var3.a()) {
               var3 = var3.b(var1);
            }

            var3.a(var1);
            return var3;
         }
      }

      var4 = this.a.a(var1);
      zaya var12;
      if (this.a(var4, var1)) {
         if (this.c == null) {
            this.c = new zaar();
         }

         this.c.a = zzf.a;
         var12 = new zaya(zzf.a);
         this.c.b = var12;
         return var12;
      } else if (var2) {
         zaye var15 = this.a;
         if (var4 != this.a.a()) {
            var15 = new zaye(this.a);
            var15.a(var4);
         }

         zaxz var13 = new zaxz(var15);
         return var13;
      } else if (this.a.m()) {
         if (var1.p.r && var1.a == 0 && (var4 == null || (var4.a & '\uffff') == var1.p.i)) {
            var1.e.b.e.a(((zyi)var1.f).a, var4 == null ? var1.n : var4.b & '\uffff', this.a.b(), this.a.d());
         }

         if (var1.k && var1.m != 0) {
            if (this.a.j()) {
               var1.m &= -2;
            }

            if (this.a.k()) {
               var1.m &= -3;
            }
         }

         if (this.c != null && this.c.a != null) {
            var3 = this.c.a.a(var1, var2);
            return var3;
         } else {
            zagu var11;
            if (var4 != null && var4 != var1.o) {
               if ((var4.a & '\uffff') == var1.p.i) {
                  var11 = zaaq.a(var1.p.g.get(var4.b & '\uffff').getCells(), this.a.b(), this.a.d(), true, var1);
               } else {
                  var11 = zaaq.a(var1, var4.a & '\uffff', var4.b & '\uffff', this.a.b(), this.a.d());
               }
            } else {
               var11 = zaaq.a(var1.d.getCells(), this.a.b(), this.a.d(), true, var1);
            }

            if (this.c == null) {
               this.c = new zaar();
            }

            this.c.a = var11;
            var12 = new zaya(var11, 9);
            return var12;
         }
      } else {
         if (var1.p.r && var1.a == 0 && (var4 == null || (var4.a & '\uffff') == var1.p.i)) {
            var1.e.b.e.a(((zyi)var1.f).a, var4 == null ? var1.n : var4.b & '\uffff', this.a.b(), this.a.d(), this.a.f(), this.a.h());
         }

         int var5 = var1.m;
         if (var1.k) {
            var1.c();
         }

         if (var4 == null) {
            var4 = var1.o;
         }

         zahn[] var6;
         int var7;
         Object var10;
         if (var4.b == var4.c) {
            var10 = this.a(var1, var4.a & '\uffff', var4.b & '\uffff');
         } else {
            var6 = new zahn[(var4.c & '\uffff') - (var4.b & '\uffff') + 1];

            for(var7 = 0; var7 < var6.length; ++var7) {
               var6[var7] = this.a(var1, var4.a & '\uffff', (var4.b & '\uffff') + var7);
            }

            var10 = new zaxj(var6, this.a.q(), this.a.p());
         }

         if (var1.k) {
            if (this.c != null) {
               this.c.a((zahn)var10, var1);
            }

            var1.a(var5);
         }

         if (var1.p.G && (var4.a & '\uffff') == var1.p.i) {
            if (var4.b == var4.c) {
               CellArea var14 = this.c(var1, var4.b & '\uffff');
               if (!var14.a()) {
                  return this.a((zahn)var10, var1, var14, var4.b & '\uffff');
               }
            } else {
               var6 = null;

               for(var7 = var4.b & '\uffff'; var7 <= (var4.c & '\uffff'); ++var7) {
                  CellArea var8 = this.c(var1, var4.b & '\uffff');
                  if (!var8.a()) {
                     if (var6 == null) {
                        zahn[] var9 = ((zaxj)var10).C();
                        var6 = new zahn[var9.length];
                        System.arraycopy(var9, 0, var6, 0, var9.length);
                     }

                     var6[var7] = this.a((zahn)var10, var1, var8, var4.b & '\uffff');
                  }
               }

               if (var6 != null) {
                  return new zaxj(var6, this.a.q(), this.a.p());
               }
            }
         }

         return (zahn)var10;
      }
   }

   private zahn a(zaay var1, int var2, int var3) {
      CellArea var4;
      if (this.a.q() == 1) {
         var4 = this.a.u();
         if (var1.k) {
            if (this.a.j()) {
               var1.m &= -2;
            }

            if (this.a.e()) {
               if (!this.a.i()) {
                  var1.m &= -3;
                  var4.EndColumn += var1.l.EndColumn - var1.h;
               }
            } else {
               var4.StartColumn += var1.l.StartColumn - var1.h;
               if (this.a.i()) {
                  var1.m &= -3;
               } else {
                  var4.EndColumn += var1.l.EndColumn - var1.h;
               }
            }
         }

         return this.a(var1, var2, var3, var4);
      } else if (this.a.p() == 1) {
         var4 = this.a.u();
         if (var1.k) {
            if (this.a.k()) {
               var1.m &= -3;
            }

            if (this.a.c()) {
               if (!this.a.g()) {
                  var1.m &= -2;
                  var4.EndRow = this.a.f() + var1.l.EndRow - var1.g;
               }
            } else {
               var4.StartRow = this.a.b() + var1.l.StartRow - var1.g;
               if (this.a.g()) {
                  var1.m &= -2;
               } else {
                  var4.EndRow = this.a.f() + var1.l.EndRow - var1.g;
               }
            }
         }

         return this.a(var1, var2, var3, var4);
      } else {
         var4 = this.a.u();
         if (var1.k) {
            if (this.a.c()) {
               if (!this.a.g()) {
                  var1.m &= -2;
                  var4.EndRow = this.a.f() + var1.l.EndRow - var1.g;
               }
            } else {
               var4.StartRow = this.a.b() + var1.l.StartRow - var1.g;
               if (this.a.g()) {
                  var1.m &= -2;
               } else {
                  var4.EndRow = this.a.f() + var1.l.EndRow - var1.g;
               }
            }

            if (this.a.e()) {
               if (!this.a.i()) {
                  var1.m &= -3;
                  var4.EndColumn += var1.l.EndColumn - var1.h;
               }
            } else {
               var4.StartColumn += var1.l.StartColumn - var1.h;
               if (this.a.i()) {
                  var1.m &= -3;
               } else {
                  var4.EndColumn += var1.l.EndColumn - var1.h;
               }
            }
         }

         return this.a(var1, var2, var3, var4);
      }
   }

   private zahn a(zaay var1, int var2, int var3, CellArea var4) {
      boolean var5 = var1.k && var1.m != 0;
      zjt var6 = var1.p.P;
      zek var7;
      if (var6.a() > 0) {
         var7 = null;
         boolean var8 = false;
         Iterator var10 = var6.e();

         while(var10.hasNext()) {
            Object var11 = var10.next();
            if (var11 != null) {
               zek var12 = (zek)var11;
               if (var12.a == var2 && var12.b == var3) {
                  switch(var12.c.b(var4)) {
                  case 1:
                  case 4:
                     if (var7 != null) {
                        int var9 = var12.c.b(var7.c);
                        if (var9 == 4) {
                           if (var12.a()) {
                              var7 = var12;
                              var8 = true;
                           }
                        } else if (var9 == 3) {
                           if (var7.a()) {
                              var8 = true;
                           } else if (var12.a()) {
                              var7 = var12;
                           }
                        } else if (var12.a()) {
                           var7 = var12;
                        }
                     } else {
                        var7 = var12;
                     }
                  case 2:
                  default:
                     break;
                  case 3:
                     if (var5) {
                        var8 = true;
                     }
                  }
               }
            }
         }

         if (var8) {
            int var18 = var6.a();
            if (var7 != null) {
               var4 = var7.c;
            }

            for(int var19 = var18 - 1; var19 > -1; --var19) {
               Object var20 = var6.a(var19);
               if (var20 == var7) {
                  var6.a(var19, (Object)null);
               } else if (var20 != null) {
                  zek var13 = (zek)var20;
                  if (var13.a == var2 && var13.b == var3 && var4.b(var13.c) == 4) {
                     var6.a(var19, (Object)null);
                  }
               }
            }

            var6.d();
            if (var7 != null) {
               var6.a((Object)var7);
               return var7.a(this.a, var1);
            }
         }

         if (var7 != null) {
            var6.b((Object)var7);
            return var7.a(this.a, var1);
         }
      }

      var7 = null;
      Object var14;
      if (var4.f() == 1) {
         if (var2 == var1.p.i) {
            var14 = new zawn(var1, var1.p.g.get(var3), var4.StartColumn, var4.StartRow, var4.EndRow);
         } else {
            var14 = new zaxc(var1, var1.p.g.v().a(var2).c(var3), var4.StartColumn, var4.StartRow, var4.EndRow);
         }
      } else if (var4.e() == 1) {
         if (var2 == var1.p.i) {
            zp var16 = var1.p.g.get(var3).getCells().getRows().a.a(var4.StartRow);
            if (var16 == null || var16.a() < 1) {
               return new zawz(zzk.a, 9, 1, var4.f());
            }

            var14 = new zawo(var1, var1.p.g.get(var3), var16, var4.StartColumn, var4.EndColumn);
         } else {
            int var15 = var1.p.g.v().a(var2).c(var3).d(this.a.b());
            if (var15 < 0) {
               return new zawz(zzk.a, 9, 1, var4.f());
            }

            var14 = new zaxd(var1, var1.p.g.v().a(var2).c(var3).b(var15), var4.StartColumn, var4.EndColumn);
         }
      } else if (var2 == var1.p.i) {
         var14 = new zawl(var1, var1.p.g.get(var3).getCells(), var4.StartRow, var4.StartColumn, var4.EndRow, var4.EndColumn);
      } else {
         var14 = new zaxb(var1, var1.p.g.v().a(var2).c(var3), this.a.b(), this.a.d(), this.a.f(), this.a.h());
      }

      zek var17 = new zek(var4, var2, var3, (zahn)var14);
      var6.a((Object)var17);
      if (var5) {
         ((zahn)var14).a(true);
         return var17.a(this.a, var1);
      } else {
         return (zahn)var14;
      }
   }

   private CellArea c(zaay var1, int var2) {
      CellArea var3 = CellArea.createCellArea(this.a.f() + 1, this.a.h() + 1, this.a.b() - 1, this.a.d() - 1);
      Iterator var4 = var1.p.F.keySet().iterator();

      while(var4.hasNext()) {
         Object var5 = var4.next();
         long var6 = (Long)var5;
         if (Cell.a(var6) == var2) {
            int var8 = Cell.b(var6);
            if (this.a.e(var8)) {
               int var9 = Cell.c(var6);
               if (this.a.f(var9)) {
                  if (var8 < var3.StartRow) {
                     var3.StartRow = var8;
                  }

                  if (var8 > var3.EndRow) {
                     var3.EndRow = var8;
                  }

                  if (var9 < var3.StartColumn) {
                     var3.StartColumn = var9;
                  }

                  if (var9 > var3.EndColumn) {
                     var3.EndColumn = var9;
                  }
               }
            }
         }
      }

      return var3;
   }

   private zahn a(zahn var1, zaay var2, CellArea var3, int var4) {
      int var5;
      int var6;
      zagu[] var7;
      Iterator var8;
      Object var9;
      long var10;
      int var12;
      int var13;
      if (var1.m()) {
         var5 = this.a.d();
         var6 = Math.min(var1.t(), var3.StartColumn - var5);
         var7 = new zagu[Math.max(var1.u(), var3.EndColumn - var5) - var6 + 1];
         com.aspose.cells.a.c.zc.a(var7, 0, var7.length, var1.o());
         var1.f();

         while(var1.g()) {
            var7[var1.j() - var6] = var1.h();
         }

         var8 = var2.p.F.keySet().iterator();

         while(var8.hasNext()) {
            var9 = var8.next();
            var10 = (Long)var9;
            if (Cell.a(var10) == var4) {
               var12 = Cell.b(var10);
               if (this.a.e(var12)) {
                  var13 = Cell.c(var10);
                  if (this.a.f(var13)) {
                     var7[var13 - var6 - var5] = (zagu)var2.p.F.get(var9);
                  }
               }
            }
         }

         return new zawg(var7, false, -var6, var1.d(), var1.b(), var1.o(), 0, false);
      } else if (!var1.n()) {
         var5 = this.a.b();
         var6 = Math.min(var1.r(), var3.StartRow - var5);
         int var17 = this.a.d();
         int var18 = Math.min(var1.t(), var3.StartColumn - var17);
         zagu[][] var19 = new zagu[Math.max(var1.s(), var3.EndRow - var5) - var6 + 1][];
         int var20 = Math.max(var1.u(), var3.EndColumn - var17) - var18 + 1;
         com.aspose.cells.a.c.zc.a(var19, 0, var19.length, var1.o());
         var1.f();

         for(; var1.g(); var19[var1.i() - var6][var1.j() - var18] = var1.h()) {
            if (var19[var1.i() - var6] == null) {
               var19[var1.i() - var6] = new zagu[var20];
               com.aspose.cells.a.c.zc.a(var19[var1.i() - var6], 0, var20, var1.o());
            }
         }

         Iterator var11 = var2.p.F.keySet().iterator();

         while(var11.hasNext()) {
            Object var21 = var11.next();
            long var22 = (Long)var21;
            if (Cell.a(var22) == var4) {
               int var15 = Cell.b(var22);
               if (this.a.e(var15)) {
                  int var16 = Cell.c(var22);
                  if (this.a.f(var16)) {
                     var19[var15 - var6 - var5][var16 - var18 - var17] = (zagu)var2.p.F.get(var21);
                  }
               }
            }
         }

         return new zawi(var19, -var6, -var18, (int[])null, var1.c(), var1.d(), var1.b(), var1.o(), 0, 0, false, false, var20);
      } else {
         var5 = this.a.b();
         var6 = Math.min(var1.r(), var3.StartRow - var5);
         var7 = new zagu[Math.max(var1.s(), var3.EndRow - var5) - var6 + 1];
         com.aspose.cells.a.c.zc.a(var7, 0, var7.length, var1.o());
         var1.f();

         while(var1.g()) {
            var7[var1.i() - var6] = var1.h();
         }

         var8 = var2.p.F.keySet().iterator();

         while(var8.hasNext()) {
            var9 = var8.next();
            var10 = (Long)var9;
            if (Cell.a(var10) == var4) {
               var12 = Cell.b(var10);
               if (this.a.e(var12)) {
                  var13 = Cell.c(var10);
                  if (this.a.f(var13)) {
                     var7[var12 - var6 - var5] = (zagu)var2.p.F.get(var9);
                  }
               }
            }
         }

         return new zawg(var7, true, -var6, var1.c(), var1.b(), var1.o(), 0, false);
      }
   }

   public void a(StringBuilder var1, zaay var2) {
      if (this.a.a() != null) {
         if (var2 != null) {
            zaan.a(var2, this.a.a(), var1);
         } else {
            zaan.a(this.a.a(), var1);
         }

         var1.append('!');
      }

      if (var2 != null) {
         if (this.a.d() == 0 && this.a.e() == this.a.i() && this.a.h() == var2.p.h()) {
            if (var2.c) {
               if (this.a.c()) {
                  var1.append('$');
               }

               var1.append(this.a.b() + 1);
               var1.append(':');
               if (this.a.g()) {
                  var1.append('$');
               }

               var1.append(this.a.f() + 1);
            } else {
               var1.append('R');
               if (this.a.c()) {
                  var1.append(this.a.b() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.b() - var2.g);
                  var1.append(']');
               }

               var1.append(":R");
               if (this.a.g()) {
                  var1.append(this.a.f() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.f() - var2.g);
                  var1.append(']');
               }
            }

            return;
         }

         if (this.a.b() == 0 && this.a.c() == this.a.g() && this.a.f() == var2.p.g()) {
            if (var2.c) {
               if (this.a.e()) {
                  var1.append('$');
               }

               var1.append(CellsHelper.columnIndexToName(this.a.d()));
               var1.append(':');
               if (this.a.i()) {
                  var1.append('$');
               }

               var1.append(CellsHelper.columnIndexToName(this.a.h()));
            } else {
               var1.append('C');
               if (this.a.e()) {
                  var1.append(this.a.d() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.d() - var2.h);
                  var1.append(']');
               }

               var1.append(":C");
               if (this.a.i()) {
                  var1.append(this.a.h() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.h() - var2.h);
                  var1.append(']');
               }
            }

            return;
         }

         if (!var2.c) {
            var1.append('R');
            if (this.a.c()) {
               var1.append(this.a.b() + 1);
            } else {
               var1.append('[');
               var1.append(this.a.b() - var2.g);
               var1.append(']');
            }

            var1.append('C');
            if (this.a.e()) {
               var1.append(this.a.d() + 1);
            } else {
               var1.append('[');
               var1.append(this.a.d() - var2.h);
               var1.append(']');
            }

            if (this.a.r() || this.a.b() != this.a.f() || this.a.d() != this.a.h()) {
               var1.append(":R");
               if (this.a.g()) {
                  var1.append(this.a.f() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.f() - var2.g);
                  var1.append(']');
               }

               var1.append('C');
               if (this.a.i()) {
                  var1.append(this.a.h() + 1);
               } else {
                  var1.append('[');
                  var1.append(this.a.h() - var2.h);
                  var1.append(']');
               }
            }

            return;
         }
      }

      if (this.a.e()) {
         var1.append('$');
      }

      var1.append(CellsHelper.columnIndexToName(this.a.d()));
      if (this.a.c()) {
         var1.append('$');
      }

      var1.append(this.a.b() + 1);
      if (this.a.r() || this.a.b() != this.a.f() || this.a.d() != this.a.h()) {
         var1.append(':');
         if (this.a.i()) {
            var1.append('$');
         }

         var1.append(CellsHelper.columnIndexToName(this.a.h()));
         if (this.a.g()) {
            var1.append('$');
         }

         var1.append(this.a.f() + 1);
      }

   }
}
